﻿using System;
using System.Collections.Generic;
using System.Text;
using LocalizationTest.Tools;
using System.Drawing;

namespace LocalizationTest
{
  class MBLGradientSelfLocator : SelfLocator
  {
    Vector2 randomPosition;
    
    public MBLGradientSelfLocator()
    {
      Vector2 randomPosition = new Vector2();
    }

    public override WorldState Execute(Experiment experiment)
    {
      if (!DebugKeyTool.IsActive("MBLGradientSelfLocator:freeze random position"))
      {
        Random rnd = new Random();
        randomPosition = new Vector2(rnd.Next(-300, +300), rnd.Next(-300, +300));
      }
      WorldState result;
      result = MBLTools.DoGradientDescent(randomPosition, experiment);
      if (DebugKeyTool.IsActive("MBLGradientSelfLocator:intelligent version"))
        result = MBLTools.DoIntelligentGradientDescent(randomPosition, experiment);
      return result;
    }
  }
}
